%@brief Read topology from the file 
%@param [in] fn : Topology file name;
%@return topo : Topology, in array cell
%@return id2pos : containers.Map structure for storing Map from id 2
%pos
%@return pos2id : Array for storeing map from pos to id.


function [topo, id2pos, pos2id]=read_topo_file(fn)
fid=fopen(fn);
id2pos=containers.Map('KeyType','double','ValueType','Double');
pos2id=[];
pos=1;
while ~feof(fid)
    line=fgetl(fid);
    tmp = str2num(line);
    pos2id=[pos2id, tmp(1)];
    id2pos(tmp(1))=pos;
    if length(tmp)>1
        topo{pos}=tmp(2:length(tmp));
    else
        topo{pos}=[];
    end
    pos=pos+1;
end
end
